#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#ifndef _YACC_TAB_HEADER_
#define _YACC_TAB_HEADER_
#include "y.tab.h"
#endif

#ifndef _DATABBASE_OPERATION_HEADER_
#define _DATABBASE_OPERATION_HEADER_

#include "operation.h"

#endif

extern DatabaseConfigStructPoint m_databaseConfig;

int main(int argc,char *argv[]){

    m_databaseConfig = (DatabaseConfigStructPoint)malloc(sizeof(DatabaseConfigStruct));
    m_databaseConfig->m_dataPath = NULL;
    m_databaseConfig->tabLength = 8;

    if(argc >= 3){

        int index = 1;
        while(index+1 < argc){
            if(!strcmp("-c",argv[index])){
                m_databaseConfig->configPath = argv[index+1];
                break;
            }
            index += 2;
        }

    }
    m_databaseConfig->configPath = "../config/LiSQL.conf";

    printf("Init database...\n");

    initDatabase();

    printf("LiSQL> ");

    while(1){
        yyparse();
    }

    return 0;
}
